Many of us have seen films containing remarkably realistic dinosaurs, aliens, animated toys and other fanciful creatures. Such animations are made possible by computer graphics. Using such techniques, a computer graphics artist can specify how each object should look and how it should change in appearance over time, and a computer then models the objects and displays them on a display such as your television or a computer screen. The computer takes care of performing the many tasks required to make sure that each part of the displayed image is colored and shaped just right based on the position and orientation of each object in a scene, the direction in which light seems to strike each object, the surface texture of each object, and other factors.
Because computer graphics generation is complex, computer-generated three-dimensional graphics just a few years ago were mostly limited to expensive specialized flight simulators, high-end graphics workstations and supercomputers. The public saw some of the images generated by these computer systems in movies and expensive television advertisements, but most of us couldn't actually interact with the computers doing the graphics generation. All this has changed with the availability of relatively inexpensive 3D graphics platforms such as, for example, the Nintendo 64® and various 3D graphics cards now available for personal computers. It is now possible to interact with exciting 3D animations and simulations on relatively inexpensive computer graphics systems in your home or office.
A problem graphics system designers confronted in the past was how to efficiently buffer graphics commands between a graphics command producer and a graphics command consumer. Various solutions to this problem were offered. For example, it is well known to provide a buffer memory between a graphics command producer and a graphics command consumer. Often, this buffer memory is connected as part of the graphics command consumer (for example, on board a graphics chip). The graphics command producer writes graphics commands into the buffer memory, and the graphics command consumer reads those graphics commands from the buffer memory. It is typical for such a buffer memory to be structured as a first-in-first-out (FIFO) buffer so that the graphics command consumer reads the graphics command in the same sequence that they were written into the buffer by the graphics command producer.
Placing such a buffer between the producer and the consumer relaxes the degree to which the producer and consumer must be synchronized. The producer can write commands into the buffer at an instantaneous rate that is independent of the instantaneous rate at which the consumer reads commands from the buffer. Even if the consumer suffers a momentary delay in reading from the buffer (e.g., as may occur when the producer asks the consumer to draw large or complex primitives), the producer will not stall unless/until it fills the buffer and has no more memory space to write new commands. Similarly, momentary delays of the producer in writing new graphics commands into the buffer will not cause the consumer to stall unless the consumer consumes all of the graphics commands in the buffer before the producer has an opportunity to write additional graphics commands.
A potential problem encountered in the past relates to the size of the buffer. Because of limitations on chip size and complexity, it is often not possible to put a very large command buffer memory on the graphics chip. A small sized FIFO buffer in the graphics hardware may not adequately load balance between the producer and the consumer, causing the producer to stall when the consumer renders big primitives. Thus, while significant work has been done in the past, further improvements are possible.
The present invention solves this problem by providing techniques and arrangements that more efficiently buffer graphics commands between a graphics command producer and a graphics command consumer. In accordance with one aspect of the invention, a part of main memory shared between the producer and consumer is allocated to a variable number of variable sized graphics command buffers. The producer can specify the number of buffers and the size of each. Writes to the graphics consumer can be routed to any of the buffers in main memory. A buffer can be attached simultaneously to the consumer and the producer, or different buffers can be attached to the consumer and the producer. In the multi-buffering approach where different buffers are attached to the consumer and the producer, the producer can write to one buffer while the consumer reads from another buffer.
To further decouple the consumer from the producer, the producer and consumer independently maintain their own read and write pointers in accordance with another aspect of the invention. Even though the consumer may not write to the buffer, it nevertheless maintains a write pointer which it uses to keep track of data valid position within the buffer. Similarly, even though the producer may not read from the buffer it is attached to, it maintains a read pointer which it uses to keep track of data valid position within the buffer. The effect of this pointer arrangement is to further decouple the producer from the consumer—reducing the synchronization requirements between the two.
In accordance with another aspect provided by this invention, the producer can write a “call display list” command to a FIFO buffer that directs the consumer to read a string of graphics commands (e.g., a display list) stored elsewhere in memory, and to subsequently return to reading the rest of the buffer. This ability to call an out-of-line graphics command string from a FIFO buffer provides additional flexibility and further decreases synchronization requirements.
In accordance with another aspect of the invention, the graphics command producer can write a graphics command stream to a FIFO buffer that includes a command which automatically redirects succeeding commands to a display list buffer. One way to visualize this is to picture the graphics command producer as a redirectable fire hose that continually produces a stream of graphics commands. The fire hose normal streams the graphics command into a FIFO buffer. However, the producer can include, within the stream, a “Begin Display List” command that causes graphics commands following the command to be written to a display list instead. An “End Display List” command inserted further on in the stream can terminate the display list and redirect the graphics command stream back to the same (or different) FIFO buffer. This feature has the advantage of allowing the graphics command producer to efficiently create reusable display lists with very low overhead.
In accordance with another aspect provided by this invention, the graphics command producer can insert a break point into any of multiple FIFO buffers. The break point can cause the consumer to interrupt. Such break points can help to synchronize the producer and the consumer when close synchronization is required.
In accordance with yet another aspect provided by this invention, the graphics system includes a producer that outputs graphics commands, a consumer that consumes the graphics commands outputted by the producer, and a storage device coupled between the producer and the consumer. The storage device stores plural variable sized buffers disposed at variable locations within the storage device. Each of the variable sized buffers receives and temporarily stores graphics commands outputted by the producer for delivery to the consumer.
In accordance with a further aspect provided by the invention, the consumer is incapable of writing to at least an active one of the plural buffers, but nevertheless maintains—independently of the producer—a write pointer for at least the active one of the plural buffers. The producer provides a producer read pointer and a producer write pointer associated with a first of the plural buffers, and the consumer independently maintains a consumer read pointer and a consumer write pointer associated with that same buffer. The consumer may increment the consumer read pointer as the consumer reads from an active buffer and suspends reading from the active buffer when the incremented consumer read pointer has a predetermined relationship with a consumer write pointer. The consumer may selectively increment the consumer write pointer in response to the producer writing to the active buffer.
In accordance with another aspect of the invention, a buffer includes a read command that controls the consumer to consume a set of graphics commands the producer stores elsewhere within the storage device, and to resume consuming graphics commands from the buffer after consuming the graphics commands stored elsewhere. The read command may specify a starting address and a length of a display list. The read command controls the consumer to read the display list of the specified length beginning at the specified starting address.
In accordance with another aspect of the invention, any of the plural buffers may provide either circular or linear first-in-first-out access.
In accordance with another aspect of the invention, any of the plural buffers can be selectively attached to both the producer and the consumer simultaneously—or one of the buffers can be attached to the producer while another buffer is attached to the consumer.
In accordance with still another aspect provided by the invention, the producer allocates the size of each of the plural buffers. Such allocation is provided so that each buffer is capable of storing at least a frame of graphics commands.
In accordance with another aspect of the invention, the producer may write a break point into any of the plural buffers. The consumer may suspend consumption of graphics commands upon encountering the break point.
In accordance with yet another aspect of the invention, each buffer may provide an overflow status indicator indicating when the producer overwrites a location in the buffer.
In accordance with yet another aspect of the invention, a status register or other indicator may indicate the status of at least one of the plural buffers. The status register may indicate, for example:                producer writer pointer position,        producer read pointer position,        consumer write pointer position, and        consumer read pointer position.        
In accordance with yet another aspect provided by this invention, a graphics system includes:                a storage buffer that receives and temporarily stores graphics commands,        a producer that writes graphics commands into the buffer, the producer maintaining a producer write pointer and a producer read pointer associated with the buffer, and        a consumer that consumes graphics commands stored within the buffer, the consumer maintaining a consumer write pointer that is independent of the producer write pointer and a consumer read pointer that is independent of the producer read pointer.        
In accordance with yet another aspect of this invention, a graphics system includes a graphics command producer that writes graphics commands into a buffer based on a producer write pointer, and a graphics commands consumer that reads graphics commands from the buffer based on a consumer read pointer. In accordance with this aspect of the invention, the consumer write pointer is independently maintained by the consumer and indicates the extent of valid data the producer has written into the buffer. The consumer ceases to consume graphics commands from the buffer upon the consumer read pointer having a predetermined relationship to the consumer write pointer.
In accordance with yet another aspect provided by this invention, an interactive graphics system includes a processor module executing an application, a graphics processor module, and at least one memory coupled to the processor module and to the graphics processor module. The method of controlling the flow of graphics commands between the processor module and the graphics processor module comprises:                dynamically establishing, under control of the application, a variable number of FIFO buffers in the memory, the application specifying the size of each of the FIFO buffers,        the application controlling the processor module to write graphics commands into at least a first of the plurality of FIFO buffers, and        the application sending graphics commands to the graphics processor module that control the graphics processor module to read graphics commands from the first FIFO buffer.        
The processor module may provide a processor module read pointer and processor module write pointer associated with the first of plurality of buffers. The graphics processor module may independently maintain a graphics processor module read pointer and a graphics processor module write pointer associated with the first buffer. The graphics processor module may increment the graphics processor read pointer each time the graphics processor module reads from the first buffer, and may suspend reading from the first buffer when the graphics processor module read pointer has a predetermined relationship with the graphics processor module write pointer. Graphics processor module may selectively auto increment the graphics processor write pointer in response to the processor writing to the first buffer.
In accordance with yet another aspect of the invention, a method of controlling the flow of graphics data comprises:                writing graphics data into plural variable sized FIFO buffers each having plural storage locations,        setting a break point associated with at least one of the plural storage locations,        reading graphics data from the plural buffers in a predetermined order,        temporarily suspending the reading step upon encountering the at least one location associated with the break point, and generating an interrupt, and        resuming the reading step in response to receipt of a clear interrupt command.        
In accordance with yet another aspect provided by this invention, a graphics system includes:                a storage device that receives and temporarily stores graphics commands,        a producer that writes commands into a buffer within the storage device, the commands including a first set of graphics commands and a read command referring to a second set of graphics commands stored elsewhere in the storage device, and        a consumer that consumes the first set of graphics commands stored within the buffer and, in response to encountering the read command, consumes the second set of graphics commands and subsequently consumes additional commands from the buffer.        